package org.jeecg.modules.qy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.qy.entity.QyMarketingReceive;
import org.jeecg.modules.qy.mapper.QyMarketingReceiveMapper;
import org.jeecg.modules.qy.service.IQyMarketingReceiveService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 营销领取详情
 * @Author: jeecg-boot
 * @Date:   2021-03-11
 * @Version: V1.0
 */
@Service
public class QyMarketingReceiveServiceImpl extends ServiceImpl<QyMarketingReceiveMapper, QyMarketingReceive> implements IQyMarketingReceiveService {

    @Override
    public int getJoinPerson(String marketingId){
        long person = count(new QueryWrapper<QyMarketingReceive>().eq("marketing_id",marketingId));
        return (int) person;
    }

    @Override
    public int getuserNum(String marketingId){
        long num = count(new QueryWrapper<QyMarketingReceive>().eq("marketing_id",marketingId).eq("use_status",1));
        return (int) num;
    }

    public int getReceiveMoney(String marketingId){
        return baseMapper.getSumMoney(marketingId);
    }

}
